package exam.wangyi.autumn.S3;

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();
        System.out.println(solution(str));
    }

    private static int solution(String str) {
        if (str.length() % 2 == 1) {
            int res1 = 0, res2 = 0;
            for (int i=0; i<str.length(); ++i) {
                char c = str.charAt(i);
                if (i % 2 == 0) {
                    if (i % 4 == 0) {
                        if (c != 'r')
                            res1++;
                        if (c != 'd')
                            res2++;
                    } else {
                        if (c != 'd')
                            res1++;
                        if (c != 'r')
                            res2++;
                    }
                } else {
                    if (c != 'e') {
                        res1++;
                        res2++;
                    }
                }
            }
            return Math.min(res1, res2);
        } else {
            return str.length() / 2;
        }
    }
}